﻿<navigation:Page x:Class="DataConnectorUI2.XAML" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
    xmlns:expressionDark="clr-namespace:System.Windows.Controls.Theming;assembly=System.Windows.Controls.Theming.ExpressionDark"
    xmlns:controlsToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
    xmlns:m="clr-namespace:Microsoft.Maps.MapControl;assembly=Microsoft.Maps.MapControl"  
    xmlns:mm="clr-namespace:Microsoft.Maps.MapControl.Core;assembly=Microsoft.Maps.MapControl"
    xmlns:localcontrols="clr-namespace:DataConnectorUI2.controls"                  
    mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480"
    Style="{StaticResource PageStyle}"
    Title="Example XAML">
    
    <Grid x:Name="LayoutRoot" Background="{StaticResource DCBackgroundBrush}">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="25" />
        </Grid.RowDefinitions>


        <m:Map  
           x:Name="MainMap" 
           CredentialsProvider=""
           NavigationVisibility="Visible" 
           Grid.Column="0" Grid.Row="0" Grid.RowSpan="1" Padding="5"
           Mode="AerialwithLabels">
            <m:Map.Children>
                <m:MapLayer x:Name="layerDraw"></m:MapLayer>
                <m:MapLayer x:Name="layerCountries"></m:MapLayer>
                <m:MapLayer x:Name="layerStatesProvinces"></m:MapLayer>
                <m:MapLayer x:Name="layerUSCounties"></m:MapLayer>
                <m:MapLayer x:Name="layerFaults"></m:MapLayer>
                <m:MapLayer x:Name="layerEarthquakes"></m:MapLayer>

            </m:Map.Children>
        </m:Map>

        <Grid x:Name="Loading" HorizontalAlignment="Center" VerticalAlignment="Center" Visibility="Collapsed" >
            <localcontrols:Spinner x:Name="LoadSpinner" Width="50" Height="50" Margin="5"/>
        </Grid>

        <Canvas x:Name="SidePanelCanvas" Grid.Column="0" Grid.Row="0" Grid.RowSpan="2" 
                HorizontalAlignment="Left" VerticalAlignment="Top" >
            <localcontrols:DragDropPanel HorizontalAlignment="Left" VerticalAlignment="Top">
                <Border x:Name="SidePanelBorder"
                                    Width="250"
                                    HorizontalAlignment="Right"
                                    VerticalAlignment="Top"
                                    Background="#BB2D2D2D"
                                    CornerRadius="8,8,8,8"
                                    Margin="5,5,5,0"
                                    BorderBrush="#FF626262"
                                    BorderThickness="2,2,2,2"
                                    ScrollViewer.HorizontalScrollBarVisibility="Visible">

                    <controlsToolkit:Expander ExpandDirection="Down" IsExpanded="True" Foreground="White" Margin="2">
                        <controlsToolkit:Expander.Header>
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="150" />
                                    <ColumnDefinition Width="20" />
                                </Grid.ColumnDefinitions>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="20" />
                                </Grid.RowDefinitions>
                                <TextBlock Text="SQL tables" Grid.Column="0"/>
                                <Button Tag="SQL Tables" Width="20" Height="20"  Grid.Column="1" Margin="0" Click="Help_ButtonClick">
                                    <Image Source="../Assets/images/helpsmall.jpg" Width="15" Height="15" />
                                    <ToolTipService.ToolTip>
                                        <ToolTip Content="SQL Tables Help Window"></ToolTip>
                                    </ToolTipService.ToolTip>
                                </Button>
                            </Grid>
                        </controlsToolkit:Expander.Header>
                        <controlsToolkit:Expander.Content>
                            <expressionDark:ExpressionDarkTheme>
                                <ScrollViewer x:Name="ScrollSidebar" VerticalScrollBarVisibility="Auto">
                                    <StackPanel Orientation="Vertical">
                                        <Border BorderBrush="Gray" BorderThickness="2" CornerRadius="5" 
                                                Margin="10" Padding="5" >
                                            <localcontrols:Layers x:Name="LayerTables" />
                                        </Border>

                                        <controlsToolkit:Expander ExpandDirection="Down" IsExpanded="True" Foreground="White" Margin="2">
                                            <controlsToolkit:Expander.Header>
                                                <Grid>
                                                    <Grid.ColumnDefinitions>
                                                        <ColumnDefinition Width="150" />
                                                        <ColumnDefinition Width="20" />
                                                    </Grid.ColumnDefinitions>
                                                    <Grid.RowDefinitions>
                                                        <RowDefinition Height="20" />
                                                    </Grid.RowDefinitions>
                                                    <TextBlock Text="Query Filter" Grid.Column="0"/>
                                                    <Button Tag="Query Filter" Width="20" Height="20"  Grid.Column="1" Margin="0" Click="Help_ButtonClick">
                                                        <Image Source="../Assets/images/helpsmall.jpg" Width="15" Height="15" />
                                                        <ToolTipService.ToolTip>
                                                            <ToolTip Content="Query Filter Help Window"></ToolTip>
                                                        </ToolTipService.ToolTip>
                                                    </Button>
                                                </Grid>
                                            </controlsToolkit:Expander.Header>
                                            <controlsToolkit:Expander.Content>
                                                <Border BorderBrush="Gray" BorderThickness="2" CornerRadius="5" Margin="10" Padding="10" >
                                                    <localcontrols:DrawTools x:Name="drawtools" />
                                                </Border>
                                            </controlsToolkit:Expander.Content>
                                        </controlsToolkit:Expander>

                                        <expressionDark:ExpressionDarkTheme>
                                            <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" >
                                                <Button Content="Query" Width="50" Height="25" Margin="5" Click="Query_ButtonClick" />
                                                <Button Content="Reset" Width="50" Height="25" Margin="5" Click="Reset_ButtonClick" />
                                            </StackPanel>
                                        </expressionDark:ExpressionDarkTheme>

                                        <controlsToolkit:Expander ExpandDirection="Down" IsExpanded="False" Foreground="White" Margin="2">
                                            <controlsToolkit:Expander.Header>
                                                <Grid>
                                                    <Grid.ColumnDefinitions>
                                                        <ColumnDefinition Width="150" />
                                                        <ColumnDefinition Width="20" />
                                                    </Grid.ColumnDefinitions>
                                                    <Grid.RowDefinitions>
                                                        <RowDefinition Height="20" />
                                                    </Grid.RowDefinitions>
                                                    <TextBlock Text="Metrics" Grid.Column="0"/>
                                                    <Button Tag="Metrics" Width="20" Height="20"  Grid.Column="1" Margin="0" Click="Help_ButtonClick">
                                                        <Image Source="../Assets/images/helpsmall.jpg" Width="15" Height="15" />
                                                        <ToolTipService.ToolTip>
                                                            <ToolTip Content="Metrics Help Window"></ToolTip>
                                                        </ToolTipService.ToolTip>
                                                    </Button>
                                                </Grid>
                                            </controlsToolkit:Expander.Header>
                                            <controlsToolkit:Expander.Content>
                                                <Border BorderBrush="Gray" BorderThickness="2" CornerRadius="5" Margin="10" Padding="10" >
                                                    <localcontrols:Metrics x:Name="metrics" />
                                                </Border>
                                            </controlsToolkit:Expander.Content>
                                        </controlsToolkit:Expander>
                                    </StackPanel>
                                </ScrollViewer>
                            </expressionDark:ExpressionDarkTheme>
                        </controlsToolkit:Expander.Content>
                    </controlsToolkit:Expander>
                </Border>
            </localcontrols:DragDropPanel>
        </Canvas>

        <!-- footer coordinate zoomlevel-->
        <StackPanel Orientation="Horizontal" Grid.Row="1" HorizontalAlignment="Left" Margin="2,2,2,2">
            <TextBlock Text="Zoom Level:" Foreground="{StaticResource DCLightBrush}" />
            <TextBlock x:Name="ZLText" Foreground="{StaticResource DCLightBrush}" />
            <TextBlock Text="Lat,Lon:" Foreground="{StaticResource DCLightBrush}" Margin="10,0,0,0" />
            <TextBlock x:Name="LLText" Foreground="{StaticResource DCLightBrush}" />
        </StackPanel>
        <!-- footer more info link -->
        <StackPanel Orientation="Horizontal" Grid.Row="1" HorizontalAlignment="Right" Margin="2,2,2,2">
            <HyperlinkButton NavigateUri="http://www.DCsys.com" Content="... more info" Margin="10,0,20,0" TargetName="_blank" Foreground="{StaticResource DCDarkBrush}" HorizontalAlignment="Right" VerticalAlignment="Center"/>
        </StackPanel>

    </Grid>

</navigation:Page>
